﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.ComponentModel;
using System.Web.UI.WebControls;

namespace Kevin.Controls
{
    /// <summary>
    /// 数据绑定列 抽象基类
    /// </summary>
    public abstract class DataField
    {
        protected DataField()
        { }

        /// <summary>
        /// 绑定类型：
        /// </summary>
        [Browsable(false)]
        public BindType BindType
        {
            get;
            set;
        }

        public string HeaderText
        {
            get;
            set;
        }

        bool _Visible = true;
        [DefaultValue(true)]
        public bool Visible
        {
            get { return _Visible; }
            set { _Visible = value; }
        }

        /// <summary>
        /// 数据对齐方式
        /// </summary>
        public AlignType Align
        {
            get;
            set;
        }

        public Unit Width
        {
            get;
            set;
        }

        //KeyIndex
        // Default value -1

        //单列合计本页值（Sum/Average/Max/Min,

    }
    public class DataBoundField : DataField
    {
        public DataBoundField()
        {
            base.BindType = BindType.DataBound;
        }
        public string FieldName
        {
            get;
            set;
        }

        public string DataFormat
        {
            get;
            set;
        }
    }



    public class DataFieldCollection : CollectionBase
    {
        public void Add(DataField item)
        {
            if (item != null)
                base.List.Add(item);
        }

        public DataField this[int index]
        {
            get { return (DataField)List[index]; }
            set { List[index] = value; }
        }

    }
}
